package org.blogwu.hyf.sso.main.bootloaderclass;

import org.blogwu.sso.until.redisUntil.jdeis.MyRedisTemplate;
import org.blogwu.sso.until.redisUntil.jdeis.RedisProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;

public class InitializeClass implements CommandLineRunner{
	private final Logger logger = LoggerFactory.getLogger(InitializeClass.class);
	
	 @Autowired
	MyRedisTemplate myRedisTemplate;
	
	@Override
	public void run(String... args) throws Exception {
		logger.info(">>>>>>>>>>>>>>>服务启动执行，执行加载数据等操作<<<<<<<<<<<<<");
		logger.info(">>>>>>>>>>>>>>>1.加载redis用户名进入redis,key:用户名   value:登录时间+邮箱<<<<<<<<<<<<<");
		String intInt=myRedisTemplate.getNoPrefix(RedisProperties.INITIALIZEREDISUSERNAME);
		if(intInt !=null || ! intInt.equals("")){
			if(intInt.equals("1")){
				logger.info("用户名参数已加载!,但并未全部加载!");
				//如果未全部加载,需要自己下判断进行增量还是清空之后重新加载
			}else if(intInt.equals("2")){
				logger.info("用户名参数已全部加载,无需再次加载!");
			}
			return;
		}
		
		
		
		
		
	}

}
